<?php echo View::factory('admin/sys/sys_left')->render(); ?>
<script type="text/javascript" src="/media/js/my_validation.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
    
        $('#dialog-form').dialog({ autoOpen: false });
    
        $('.add_flinktype').click(function(){
            $('#dialog-form').dialog('open');
            return false;
        });
    
        $('.edit').click(function(){
            var id = $(this).text();
            $('#form1').attr('action', '/admin/flinktype/edit/'+id);
            $('#dialog-form').dialog('open');
            return false;
        });
    
        $('.delete').click(function() {
            var del = this;
            deletenotice = "您确定要删除<font color='#FF0084'>" +$('#flinktype-'+$(del).text()).text() +"</font>吗？";
            $('#delete-notice').html(deletenotice);
            $( "#dialog:ui-dialog" ).dialog( "destroy" );
            $( "#dialog-confirm" ).dialog({
                resizable: false,
                height:140,
                modal: true,
                buttons: {
                    "确定": function() {
                        $( this ).dialog( "close" );
                        var deleteurl = "/admin/flinktype/delete/"+$(del).text();
                        window.location.href=deleteurl;
                    },
                    "取消": function() {
                        $( this ).dialog( "close" );
                    }
                }
            });
            return false;
        });

    });
</script>
<div id="dialog-confirm" title="友情提醒" style="display: none">
    <p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span><span id="delete-notice">您确定要删除该用户吗？</span></p>
</div>
<div id="do_right" class="catalog_right">
    <div class="box" style="overflow:hidden;">
        <h3 id="h3_left">链接类型管理</h3>
        <div id="right_button"><a href="#"><button id="add" class="add_flinktype">添加类型</button></a></div>
        <div class="clear"></div>

        <div id="tabs">
            <ul>
                <li><a href="#tabs-1">类型列表</a></li>

            </ul>
            <!--START tabs-1 -->
            <div id="tabs-1">
                <ul>
                    <?php  $i = 1;
                          if (isset($flinktypes)) : ?>
                        <?php foreach ($flinktypes as $key => $result): ?>
                    <li style="margin-bottom: 10px; float:left;clear: none;">
                                <button type="button"  class="button" style="width: 200px;"><span id="flinktype-<?php echo $result->chr_typeid ?>"><?php echo $result->chr_typename ?></span><a href="#"><button class="edit" type="button"><?php echo $result->chr_typeid ?></button></a><a href="#" ><button class="delete"><?php echo $result->chr_typeid ?></button></a></button>
                            </li>
                            
                        <?php $i++;endforeach;?>
                    <?php endif ?>

                </ul>
                <div style="clear:both;"></div>
            </div>
            <!--END tabs-1 -->
        </div>

    </div>
</div>
<div id="dialog-form" title="添加友情链接类型">
    <form action="/admin/flinktype/add" method="post" name="form1" id="form1">
        <table border="0" cellpadding="0" cellspacing="0" width="280" style="margin:auto;">
            <tr>
                <td class="tdLabel"><label>名称:</label></td>
                <td class="tdInput"><input type="text" id="chr_typename" name="chr_typename" class="text required" />
            </tr>
            <tr>
                <td colspan="2" align="center"><input type="submit" value="添 加"></td>
            </tr>
        </table>
    </form>
</div>